/* 
 * $Id$
 *
 *
 * Ryan Boyd 
 *
 *!\file intdefs.h
 * \brief Definitions for 8, 16, 32 and 64 bit integer operations.
 *
 *
**/

#ifndef INTDEFS_H
#define INTDEFS_H

#include <stdint.h>


/*!\def Float_T
 * \brief A configurable floating point type.
 * Writing code with Float_T means you need to account for what happens
 * when a \a double is substituted for a \a float and vice-versa.
 */

/*!\def WITH_DOUBLE
 * \brief If this is defined, \aFloat_T is a double, else its a float.
 *
 */
#if defined(WITH_DOUBLE)
#  define Float_T double
#else
#  define Float_T float
#endif

/*!\typedef typedef uint8_t Byte
 * \brief Type definition for a Byte.
 * An 8-bit unsigned integer as defined by your libc's \c stdint.h.
 */
typedef uint8_t Byte;

/*!\typedef typedef Byte* MemByte
 * \brief Type definition for a pointer to a Byte.
 * A pointer to a Byte.
 */
typedef Byte* MemByte;

/*!\def MASK_OFF
 *\brief A const Byte with zero bits on.
 */
#define MASK_OFF ((Byte)0)

/*!\def MASK_ON
 *\brief A const Byte with all bits on.
 */
#define MASK_ON ((Byte)0xff)

/*!\def MASK0
 *\brief A const Byte bit shifted left zero positions.
 * 2^0 = 1.
 */
#define MASK0 ((Byte)(1<<0))

/*!\def MASK1
 *\brief  A const Byte bit shifted left 1 position.
 * 2^1 = 2.
 */
#define MASK1 ((Byte)(1<<1))

/*!\def MASK2
 *\brief  A const Byte bit shifted left 2 positions.
 * 2^2 = 4.
 */
#define MASK2 ((Byte)(1<<2))

/*!\def MASK3
 *\brief  A const Byte bit shifted left 3 positions.
 * 2^3 = 8.
 */
#define MASK3 ((Byte)(1<<3))

/*!\def MASK4
 *\brief  A const Byte bit shifted left 4 positions.
 * 2^4 = 16.
 */
#define MASK4 ((Byte)(1<<4))

/*!\def MASK5
 *\brief  A const Byte bit shifted left 5 positions.
 * 2^5 = 32.
 */
#define MASK5 ((Byte)(1<<5))

/*!\def MASK6
 *\brief  A const Byte bit shifted left 6 positions.
 * 2^6 = 64.
 */
#define MASK6 ((Byte)(1<<6))

/*!\def MASK7
 *\brief  A const Byte bit shifted left 7 positions.
 * 2^7 = 128.
 */
#define MASK7 ((Byte)(1<<7))


/*!\def byte_static_init( b )
 * \brief statically initialize a byte object to \a b value.
 */
#define byte_static_init( b ) (Byte) b
int is_bit_on(MemByte, Byte);
Byte bit_all_off(MemByte); 
Byte bit_all_on(MemByte);
Byte bit_all_flip(MemByte);
Byte bit_on(MemByte, Byte); 
Byte bit_off(MemByte, Byte);
Byte bit_flip(MemByte, Byte);

#endif
